package javaCode.chapter10.enum_;

/**
 * @author 徐州城
 * @version 1.0
 */
public class Enumeration02 {
    public static void main(String[] args) {
        System.out.println(Season_.AUTUMN);
        System.out.println(Season_.SPRING);
    }
}

class Season_{ //类
    private String name;
    private String desc; //描述

    //定义了四个对象，固定.
    public final static Season_ SPRING = new Season_("春天","温暖");
    public final static Season_ SUMMER = new Season_("夏天","炎热");
    public final static Season_ AUTUMN = new Season_("秋天","凉爽");
    public final static Season_ WINTER = new Season_("冬天","寒冷");
    //1. 将构造器私有化，目的防止 被别的类 直接 new
    //2. 去掉setXXX方法，防止属性被修改
    //3. 在Season_内部，直接创建固定的对象
    //4. 可以加入 final 修饰符 不会导致类的加载
    private Season_(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }

    public String getName() {
        return name;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public String toString() {
        return "Season_{" +
                "name='" + name + '\'' +
                ", desc='" + desc + '\'' +
                '}';
    }
}
